package com.mademoisellegeek.carrentalsimulation;

import com.mademoisellegeek.carrentalsimulation.enums.OptimisationType;
import java.util.HashMap;

public class Efficiency {

    public static void generateDataAndAddToResults(int[][] results) {
        HashMap<String, Integer> userInput = new HashMap<String, Integer>();
        userInput.put(CarRentalSimulationApp.NB_VEHICLES_KEY, Utils.randomInt(30, 100));
        userInput.put(CarRentalSimulationApp.MIN_DAYS_REQUESTED_KEY, Utils.randomInt(5000, 20000));
        userInput.put(CarRentalSimulationApp.REGENERATE_KEY, 1);
        OptimisationData data = CarRentalSimulationApp.initialiseSimulationValues(userInput);
        int algorithmId = 0;
        for (OptimisationType type : OptimisationType.values()) {
            addResults(algorithmId, type.run(data), results);
            algorithmId++;
        }
    }

    private static void addResults(int algorithmId, int[] runResults, int[][] totalResults) {
        int[] before = totalResults[algorithmId];
        for (int i = 0; i < 6; i++) {
            before[i] += runResults[i];
        }
    }
}